<style type="text/css">

.thumbnail{
    margin-bottom: 0px;
    height: 420px;
}
.thumbnail img.apppic{
    width: 100%;
    height: 420px;
    display: block;
}
.note{
    padding: 5px ;
}

</style>

<div class="col-md-12">
    <div class="page-bar margin-bottom-10 note ">
        <div class="page-toolbar">
            <a ajax-dialog class="btn blue " href="{$addUrl}">新增页面</a>
        </div>
    </div>
</div>

<volist name="data[volist]" id="vo">
    <Widget:show col="3" title="{$vo.name}">
    <Widget:action title="">
        <div class="btn-group">
            <a data-toggle="dropdown" href="javascript:;" class="btn btn-sm blue"><i class="fa fa-bars" ></i><i class="fa fa-angle-down "></i>
            </a>
            <ul class="dropdown-menu pull-right">
                <li>
                    <a ajax-dialog href="{:U("Page/edit?apid=$apid&id=$vo[id]")}">页面信息</a>
                </li>
                <li>
                    <a data-pk="{$vo.id}" btn-file href="{:U("FileManger/upfile")}">更改封面</a>
                </li>
                <li>
                    <a href="{:U("Content/index?apid=$apid&id=$vo[id]")}">内容管理</a>
                </li>

                <li>
                    <a delete-confirmation href="{:U("Page/delete?apid=$apid&id=$vo[id]")}">删除</a>
                </li>
            </ul>
        </div>
    </Widget:action>
        <div class="thumbnail">
            <img src="{$vo.picurl}" >
        </div>
    </Widget:show>
</volist>
<script type="text/javascript">
var pk = '';
var dialog = '';
function selectFiled (picurl,id,name) {
    dialog.close();
    var url = "{:U('Page/updateField')}";
    $.post(url,{value:picurl,name:'picurl',pk:pk},function(req){
        //
    })
    return false;
}    
$(function(){




    var box = $('<div style="max-height:500px;overflow-y: auto;" class="row"></div>');
    dialog = new BootstrapDialog({
        message: '',
        size:'size-wide',
        title:'文件上传',
        buttons: [{
            label: '首页',
            cssClass: 'blue',
            action: function(dg) {
                var obj = dg.getModalBody();
                obj.find('.frist').click();
            }
        },{
            label: '上一页',
            cssClass: 'blue',
            action: function(dg) {
                var obj = dg.getModalBody();
                obj.find('.prep').click();
            }
        },{
            label: '下一页',
            cssClass: 'blue',
            action: function(dg) {
                var obj = dg.getModalBody();
                obj.find('.next').click();
            }
        },{
            label: '取消',
            action: function(dialog){
                dialog.close();
            }
        }]
    });
    $('[btn-file]').on('click',function(event){
        event.preventDefault();
        var url = "{:U('FileManger/upfile')}";
        box.load(url,function(req){
            dialog.setMessage($(req));
            dialog.open();
        });
        pk = $(this).data('pk');
    })


    $('[delete-confirmation]').confirmation({
        container: 'body',
        title:'该页面下的内容也将会一起被删除',
        href:false,
        onConfirm:function(event, element){
            event.preventDefault();
            el  = $(element);
            var url = el.attr('href');
            $.get(url,function(req){
                $.bootstrapGrowl(req.info);
                var st = req.status;
                if (st == 1) {
                    var c = $('[data-pjax-container]');
                    if (c.length > 0) {
                        $.pjax.reload(c);
                    }
                }
            })
        }
    });
    
})
</script>
